﻿using Caliburn.Micro;
using System;
using System.Collections.ObjectModel;

namespace KouDai.Phone.Models
{
    public class RankingListEntity : PropertyChangedBase
    {
        private string _updateTimeTip;
        private ObservableCollection<HoneyEntity> _honeyItems;

        /// <summary>
        /// 日期
        /// </summary>
        public string Date { get; set; }
        /// <summary>
        /// 上次更新的时间戳
        /// </summary>
        public Int64 LatestUpdateTime { get; set; }
        /// <summary>
        /// 更新的提示
        /// </summary>
        public string UpdateTimeTip
        {
            get { return "（" + _updateTimeTip + "）"; }
            set
            {
                _updateTimeTip = value;
                this.NotifyOfPropertyChange(() => this.UpdateTimeTip);
            }
        }
        /// <summary>
        /// 更新的周
        /// </summary>
        public string Week { get; set; }
        /// <summary>
        /// 本次更新的商品
        /// </summary>
        public ObservableCollection<HoneyEntity> HoneyItems
        {
            get
            {
                if (this._honeyItems != null)
                {
                    foreach (HoneyEntity item in _honeyItems)
                    {
                        item.Num = _honeyItems.IndexOf(item) + 1;
                    }
                }
                return _honeyItems;
            }
            set
            {
                _honeyItems = value;
                this.NotifyOfPropertyChange(() => this.HoneyItems);
            }
        }
    }
}
